package com.yao.sys.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yao.auth.entity.dto.RoleDto;
import com.yao.sys.entity.dto.UserRoleRelDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 用户角色关系表
 *
 * @author autoCode
 * @version 1.0.0-SNAPSHOT
 * @date 2020-04-09
 */
@Mapper
@Repository
public interface UserRoleRelMapper extends BaseMapper<UserRoleRelDto> {

    @Select("select r.id, r.keys, r.name from sys_role r, sys_user_role_rel ur where r.id = ur.roleId and ur.userId = #{userId}")
    List<RoleDto> findByUserId(Integer userId);
}